Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Aug 10, 2023

Solves one item in #1392 partially.

@hebasto
Copy link
Member Author

hebasto commented Aug 10, 2023

@achow101

Could you please explicitly enable the actions as follows:

  • docker/setup-buildx-action@*
  • docker/build-push-action@*
  • addnab/docker-run-action@*

?

In the meantime, reviewers can view the builds in my personal repo: https://github.com/hebasto/secp256k1/actions/runs/5818492202.

@real-or-random
Copy link
Contributor

In the meantime, reviewers can view the builds in my personal repo: hebasto/secp256k1/actions/runs/5818492202.

Caching doesn't seem to work properly. I suggest trying to remove the mode=min.

@hebasto
Copy link
Member Author

hebasto commented Aug 10, 2023

In the meantime, reviewers can view the builds in my personal repo: hebasto/secp256k1/actions/runs/5818492202.

Caching doesn't seem to work properly.

Which job?

@real-or-random
Copy link
Contributor

real-or-random commented Aug 10, 2023

In the meantime, reviewers can view the builds in my personal repo: hebasto/secp256k1/actions/runs/5818492202.

Caching doesn't seem to work properly.

Which job?

Sorry, all jobs, but I meant to include a link to the job. But I think I was wrong. The "Building container" stages takes ~5min, but all of this time seems to be spent downloading from the cache?! I didn't expect that it's that slow.

edit: Fetching from ghcr is similarly slow, ok... https://github.com/hebasto/secp256k1/actions/runs/5783560280/job/15672591894#step:2:54

@hebasto
Copy link
Member Author

hebasto commented Aug 10, 2023

The "Building container" stages takes ~5min, but all of this time seems to be spent downloading from the cache?!

Correct.

I didn't expect that it's that slow.

That is what I meant in #1396 (comment) :)

@real-or-random
Copy link
Contributor

Okay! But do you agree with my observation that GHA cache vs. GHCR doesn't make a significant difference here? Then we can ignore that piece when deciding what to use for Linux tasks.

(Heck, for Linux native tasks with standard gcc and clang, using Docker image at all may be faster... But I'd say let's worry about optimizations later.)

@hebasto
Copy link
Member Author

hebasto commented Aug 10, 2023

Okay! But do you agree with my observation that GHA cache vs. GHCR doesn't make a significant difference here? Then we can ignore that piece when deciding what to use for Linux tasks.

I agree.

The advantage of GHA cache over GHCR is not requiring write permissions for a workflow.

@achow101
Copy link
Member

Updated the actions settings

@hebasto hebasto force-pushed the 230810-gha-win branch 2 times, most recently from 2dc7abe to dba39d0 Compare August 10, 2023 23:32
@hebasto
Copy link
Member Author

hebasto commented Aug 11, 2023

Reworked. The third-party addnab/docker-run-action has been replaced with own reusable workflow.

@hebasto
Copy link
Member Author

hebasto commented Aug 11, 2023

@real-or-random

Do you have permissions to re-run workflows and jobs?

@real-or-random
Copy link
Contributor

Hm, sad to see that it's already starting to get flaky: https://github.com/bitcoin-core/secp256k1/actions/runs/5827144103/job/15802793632?pr=1398 Perhaps this helps: moby/buildkit#3969

Anyway, I like the changes.

@hebasto
Copy link
Member Author

hebasto commented Aug 11, 2023

Hm, sad to see that it's already starting to get flaky: bitcoin-core/secp256k1/actions/runs/5827144103/job/15802793632?pr=1398

From my experience, I would estimate the rate of such kind of failure is about 1 (one) per cent of total runs.

@hebasto
Copy link
Member Author

hebasto commented Aug 11, 2023

Reworked with using a composite action to avoid environment variables hassles.

Using compression=estargz,force-compression=true for caching as suggested by @real-or-random offline.

@hebasto
Copy link
Member Author

hebasto commented Aug 11, 2023

The only thing I'm not sure about is that whether PR branches will hit image cache from the master branch.

@hebasto
Copy link
Member Author

hebasto commented Aug 11, 2023

The only thing I'm not sure about is that whether PR branches will hit image cache from the master branch.

I've just finished this check. It works:

image

Docker layers caches are re-used from the base/default branch.

@real-or-random
Copy link
Contributor

Using compression=estargz,force-compression=true for caching as suggested by @real-or-random offline.

Okay, as @hebasto figured out that doesn't work with the GHA cache backend for now (see https://docs.docker.com/build/cache/backends/#cache-compression). Well fine.

@hebasto
Copy link
Member Author

hebasto commented Aug 11, 2023

Using compression=estargz,force-compression=true for caching as suggested by @real-or-random offline.

Okay, as @hebasto figured out that doesn't work with the GHA cache backend for now (see docs.docker.com/build/cache/backends/#cache-compression). Well fine.

Dropped.

@real-or-random
Copy link
Contributor

This looks pretty clean now. Will perform a closer review soon.

One nit: Perhaps it's now time to rename cirrus.ci to ci.sh.

Some observations:

  • All the Docker stuff is a bit more complex on GHA than on Cirrus CI, but I still believe Docker is a good idea: It makes it easier to reproduce failures locally, and in principle, it makes it easy to switch between different CI providers. For example, we can easily switch back to Cirrus (self-hosted) runners if we keep the Docker images.
  • Store/restoring the Docker build cache is still a bit slow. It's a bit sad that downloading the cache takes almost as long as running the actual CI script. But we may be able to improve this later. And even if we don't manage to improve, I think the build times are acceptable. (Moreover, the native Windows builds don't use Docker, so we still get some immediate feedback for the most obvious problems.)

@hebasto
Copy link
Member Author

hebasto commented Aug 11, 2023

One nit: Perhaps it's now time to rename cirrus.ci to ci.sh.

Done.

Copy link
Contributor

@real-or-random real-or-random left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK mod nits

Do you think it makes sense to retain the Cirrus config commented out, like sometimes done in Core? This would require a bit more work here to make sure it still works now that we split the image.

for var in "$(echo '${{ toJSON(matrix.configuration.env_vars) }}' | jq -r 'to_entries | .[] | "\(.key)=\(.value)"')"; do
echo "$var" >> "$GITHUB_ENV"
done
echo "MAKEFLAGS=-j$(($(nproc) + 1))" >> "$GITHUB_ENV"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This will probably override MAKEFLAGS if in env_vars. Perhaps it's a bit cleaner to simply prepend MAKEFLAGS with $(($(nproc) + 1)), and do this inside ci.sh?

Copy link
Member Author

@hebasto hebasto Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep the scope of this PR limited, is it OK to just set mingw_debian.env.MAKEFLAGS: '-j3'?

UPD. Or rely on the global env.MAKEFLAGS: '-j4'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or rely on the global env.MAKEFLAGS: '-j4'?

Implemented.

Comment on lines +95 to +119
- run: cat tests.log || true
if: ${{ always() }}
- run: cat noverify_tests.log || true
if: ${{ always() }}
- run: cat exhaustive_tests.log || true
if: ${{ always() }}
- run: cat ctime_tests.log || true
if: ${{ always() }}
- run: cat bench.log || true
if: ${{ always() }}
- run: cat config.log || true
if: ${{ always() }}
- run: cat test_env.log || true
if: ${{ always() }}
- name: CI env
run: env
if: ${{ always() }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be refactored into an action? Or is this overkill?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be refactored into an action? Or is this overkill?

In that case it won't show separated entries in the log.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok yes, let's leave it like this for now.

(I'm not happy with this and it should be reworked in a separate PR. I had introduced this printing of files to make sure that we always have all logs, and I think that's a good idea in general. But it's not a good idea to pipe it only to files. We should pipe it to files but also keep stdout/stderr, e.g., using tee. People get confused about this over and over because they can't find the error messages in the failing tasks etc.)

@real-or-random
Copy link
Contributor

@MarcoFalke if you want to have a look

Copy link
Contributor

@jonasnick jonasnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK, thanks @hebasto!

After @real-or-random explained this approach to me I was able to understand what happens without doing too much research into the github actions semantics. In general, it would be nice to have some comments that document what happens (e.g. what exactly is the purpose of docker_wine_cache and what it does if the image already exists), but we can add them over time in follow-up PRs.

@hebasto
Copy link
Member Author

hebasto commented Aug 17, 2023

Converting this PR to a draft for now.

Please review #1401 first.

@hebasto hebasto marked this pull request as draft August 17, 2023 13:40
@hebasto hebasto marked this pull request as ready for review August 17, 2023 20:50
@hebasto
Copy link
Member Author

hebasto commented Aug 17, 2023

Rebased.

Ready for review.

@hebasto
Copy link
Member Author

hebasto commented Aug 18, 2023

Rebased.

@real-or-random
Copy link
Contributor

I believe it's possible to shave off several minutes from the tasks that run in Docker by setting the docker build driver to docker, see docker/buildx#107 (comment) ff . This should avoid the long "sending tarball" phases. It can be done by setting driver: docker, see https://github.com/docker/setup-buildx-action#inputs . But let's experiment with this after this PR. :)

Copy link
Contributor

@real-or-random real-or-random left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 87d35f3

@hebasto
Copy link
Member Author

hebasto commented Aug 18, 2023

I believe it's possible to shave off several minutes from the tasks that run in Docker by setting the docker build driver to docker, see docker/buildx#107 (comment) ff . This should avoid the long "sending tarball" phases. It can be done by setting driver: docker, see docker/setup-buildx-action#inputs . But let's experiment with this after this PR. :)

Unfortunately, GitHub Actions cache does not work with the docker build driver.

Copy link
Contributor

@jonasnick jonasnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 87d35f3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants